<?php

use yii\db\Migration;

/**
 * Class m171124_032224_prompt_news_table
 */
class m171124_032224_instation_message_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('instation_message', [
            'id' => $this->bigPrimaryKey(),
            'package_id'=> $this->integer(10)->notNull()->comment('资产包id,默认0'),
            'project_id'=> $this->integer(10)->notNull()->comment('单项目id,默认0'),
            'sender'=> $this->integer(10)->notNull()->comment('发件人'),
            'message_val' => $this->text()->defaultValue('')->comment('消息内容 json'),
            'message_start_time' => $this->integer()->defaultValue(time())->comment('消息发送时间'),
        ]);

    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('instation_message');
    }

    /*
    // Use up()/down() to run migration code without a transaction.
    public function up()
    {

    }

    public function down()
    {
        echo "m171124_032224_prompt_news_table cannot be reverted.\n";

        return false;
    }
    */
}
